#include <stdio.h>

int main() {
    double money = 0;
    scanf("%lf", &money);
    int month = 0;
    int day = 0;
    scanf("%d %d", &month, &day);
    int coupons = 2;
    scanf("%d", &coupons);
    double total = 0;
    total = money;

    if(day == 11 && day == 11)
    {
        total *= 0.7;
    }
    if(day == 12 && day == 12)
    {
        total *= 0.8;
    }
    if(coupons)
    {
        total -= 50.0;
    }
    if(total > 0)
    {
        printf("%.2lf", total);
    }
    else {
    {
        total = 0.00;
        printf("%.2lf", total);
    }
    }
    
    return 0;
}
